package practice;

import java.util.Scanner;

/**
 * 包含偶数个‘o’的最长子字符串的长度 字符串是连接成环的
 */
public class LongestSubStrLengthI {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            int count = 0;
            String str = sc.nextLine();
            for (char c: str.toCharArray()) {
                if (c == '0') {
                    count++;
                }
            }
            if (count % 2 == 0) {
                System.out.println(str.length());
            } else {
                System.out.println(str.length()-1);
            }
        }
    }
}
